package cn.jiyun.user.controller;

import cn.jiyun.user.common.R;
import cn.jiyun.user.pojo.Goods;
import cn.jiyun.user.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;
    @RequestMapping("/findPage")
    public R findPage(@RequestParam(defaultValue = "1")Integer page,@RequestParam(defaultValue = "5")Integer pageSize,String name){
        return goodsService.findPage(page,pageSize);
    }
    @RequestMapping("/add")
    public R add(@RequestBody Goods goods){
        goodsService.add(goods);
        return R.success("添加成功");
    }
    @RequestMapping("/findById")
    public R findById(Integer id){
       return goodsService.findById(id);
    }

}
